package threshold

import (
	
)

// Mode represents the type of value used as threshold.
type Mode string

const (
	Percentage Mode = "percentage"
	Absolute   Mode = "absolute"
)

// DisplayStyle represents how the threshold should be visualized.
type DisplayStyle string

const (
	Off             DisplayStyle = "off"
	AsFilledRegions DisplayStyle = "area"
	AsLines         DisplayStyle = "line"
	Both            DisplayStyle = "line+area"
)

// Option represents an option that can be used to configure an axis.
type Option func(threshold *Threshold)

type Step struct {
	Color string
	Value float64
}

// Threshold represents a threshold visualization.
type Threshold struct {
	baseColor   string
	fieldConfig *sdk.FieldConfig
}

// New creates a new Threshold configuration.
func ( *sdk.FieldConfig,  ...Option) *Threshold {
	 := &Threshold{fieldConfig: }

	 := []Option{
		Style(AsLines),
		ValueMode(Absolute),
		BaseColor("green"),
	}
	for ,  := range append(, ...) {
		()
	}

	return 
}

// Style defines the thresholds display style.
func ( DisplayStyle) Option {
	return func( *Threshold) {
		.fieldConfig.Defaults.Custom.ThresholdsStyle.Mode = string()
	}
}

// BaseColor defines the color of the thresholds' base.
func ( string) Option {
	return func( *Threshold) {
		.baseColor = 
	}
}

// ValueMode defines how to interpret the threshold values.
func ( Mode) Option {
	return func( *Threshold) {
		.fieldConfig.Defaults.Thresholds.Mode = string()
	}
}

// Steps defines threshold steps.
func ( ...Step) Option {
	return func( *Threshold) {
		 := make([]sdk.ThresholdStep, 0, len())

		for  := range  {
			 = append(, sdk.ThresholdStep{
				Color: [].Color,
				Value: &[].Value,
			})
		}

		.fieldConfig.Defaults.Thresholds.Steps = append(
			// Base
			[]sdk.ThresholdStep{{Color: .baseColor}},
			// User-defined steps
			...,
		)
	}
}